import VueRouter from "vue-router";
import Home from "../components/Home"
import Mine from "../components/Mine"
import Search from "../components/Search"
import Player from "../components/Player.vue"
import Layout from "../components/Layout.vue"
import GetMore from "../components/Home/GetMore.vue"
import TopList from "../components/Rank/topList.vue"
import Result from "../components/Search/result.vue"
import UserInfo from "../components/Mine/userInfo"

const router = new VueRouter({
    mode:'hash',
    linkActiveClass:'active',
    routes:[
        {
            // 把layout作为需要展示的组件的父路由，layout路径设置为/
            // 这样layout会在子路由中展示
            path:'/',
            // name:'Layout',
            component:Layout,
            children:[
                {
                    path:'/',
                    name:'Home',
                    component:Home,
                },
                {
                    path:'/mine',
                    name:'Mine',
                    component:Mine
                },
                {
                    path:'/search',
                    name:'Search',
                    component:Search
                },
                {
                    path:'/rank',
                    name:'Rank',
                    //异步加载路由，需要展示时再加载
                    component:() => import( "../components/Rank"),
                    children:[
                       
                    ]
                },
            ]
        },
        {
            path:'/getmore/:type',
            name:'GetMore',
            component:GetMore,
        },
        {
            path:'/player/:id/:name/:image',
            name:"Player",
            component:Player
        },
        {
            path:'/toplist/:id',
            name:"TopList",
            component:TopList
        },
        {
            path:'/result/:keywords',
            name:"Result",
            component:Result
        },
        {
            path:'/userinfo/:id',
            name:"UserInfo",
            component:UserInfo
        }
    ]
})

export default router